<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
cfc('core')->checklogin();
$return=array();
$worker = pdo_get('jy_meye_peisong_member',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'status'=>1));
if(empty($worker)){
		exi('您不是配送员！','error');
}
if($_RQ['op']=='main'){
	$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
	$worker['today_money']=pdo_getsum('jy_meye_order',array('uniacid'=>$_SESSION['uniacid'],'peisong_id'=>$_SESSION['uid'],'status >'=>2,'createtime >'=>$daytime),'price');
	$worker['today_num']=pdo_count('jy_meye_order',array('uniacid'=>$_SESSION['uniacid'],'peisong_id'=>$_SESSION['uid'],'status >'=>2,'createtime >'=>$daytime));
	$worker['all_money']=pdo_getsum('jy_meye_order',array('uniacid'=>$_SESSION['uniacid'],'peisong_id'=>$_SESSION['uid'],'status >'=>2),'price');
	$worker['all_num']=pdo_count('jy_meye_order',array('uniacid'=>$_SESSION['uniacid'],'peisong_id'=>$_SESSION['uid'],'status >'=>2));
	set_html('title','配送员中心');
	$return['worker']=$worker;
	exi($return);
	
}
if($_RQ['op']=='set'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
	
		$data=array(
				'title'=>$postdata['title'],
				'address'=>$postdata['address'],
				'mobile'=>$postdata['mobile'],
				);
		$worker_id=pdo_getcolumn('jy_meye_peisong_member',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']),'id');		
		if($worker_id){
			pdo_update('jy_meye_peisong_member',$data,array('id'=>$worker_id));
			exi('修改成功','','main');		 
		}
	}
	$worker=pdo_get('jy_meye_peisong_member',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	$return['worker']=$worker;
	exi($return);
}	
?>